package com.ys.service.business.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.alibaba.fastjson.JSON;
import com.ys.entity.business.TpQuestion;
import com.ys.mapper.business.TpProductBasisMapper;
import com.ys.mapper.business.TpQuestionMapper;
import com.ys.mapper.sys.SysMapper;
import com.ys.service.business.TpQuestionService;
import com.ys.vo.R;

@Service("tpQuestionService")
public class TpQuestionServiceImpl implements TpQuestionService {
	@Autowired
	private TpQuestionMapper tpQuestionMapper;
	

	@Override
	public R add(Map<String, Object> params) {
		
		String code = params.get("code").toString();
		if (code == null ) {
			return R.error("编码不能为空");
		} else if (new TpQuestion().setCode(code).count() > 0) {
			return R.error("已存在");
		}
		
		TpQuestion entity = JSON.parseObject(JSON.toJSONString(params), TpQuestion.class);
		tpQuestionMapper.insert(entity);
		return R.ok("操作成功");
	}


	@Override
	public R edit(Map<String, Object> params) {
		// TODO Auto-generated method stub
		return null;
	}


	@Override
	public R export(Map<String, Object> params) {
		// TODO Auto-generated method stub
		return null;
	}


	@Override
	public R search(Map<String, Object> params) {
		// TODO Auto-generated method stub
		return null;
	}
}
